package com.puhui.education.util;

/**
 * Created by Administrator on 2016/5/28.
 * 根据屏幕宽度或高度及比例计算大小
 */

public class ComputeSizeByScaleUtil {
    public final static int SCREEN_WIDTH = 0;
    public final static int SCREEN_HEIGHT = 1;

    /**
     *
     * @param type  计算标准(以屏幕高度或宽度作为计算标准)
     * @param scale 计算比例
     * @return
     */
    public static int computeSize(int type, float scale) {
        switch (type) {
            case SCREEN_WIDTH:
                return (int) (ScreenUtil.getScreenWidth() * scale);
            case SCREEN_HEIGHT:
                return (int) (ScreenUtil.getScreenHeight() * scale);
        }
        return -1;
    }
}
